import request from '@/utils/request'
import qs from 'qs'

// 获取后台订单的列表
export function
getOrderList(pageNumber, pageSize, queryList, start_createTime, end_createTime) {
  return request({
    url: '/order/order/list_rewrite',
    method: 'get',
    params: {
      pageNumber: pageNumber,
      pageSize: pageSize,
      storeId: sessionStorage.getItem("storeId"),
      orderNumber: queryList.orderNumber,
      startCreateTime: start_createTime,
      endCreateTime: end_createTime
    }
  })
}

//查看后台订单详情
export function getOrderDetail(orderId) {
  return request({
    url: '/order/order_item/detail',
    method: 'get',
    params: {
      orderId: orderId,
    }
  })
}

//查看工作台餐桌订单详情
export function workBenchOrderDetail(deskId) {
  return request({
    url: '/order/order/work_bench_detail',
    method: 'get',
    params: {
      deskId,
    }
  })
}


//查看工作台点餐进度
export function scheduleListS(pageNumber, pageSize, orderId, status,) {
  return request({
    url: '/order/order_item/schedule_list',
    method: 'get',
    params: {
      pageNumber,
      pageSize,
      orderId,
      status
    }
  })
}


//工作台赠菜或退菜
export function giftOrCancle(orderItemId, status) {
  return request({
    url: '/order/order_item/gift_or_cancle',
    method: 'post',
    data: qs.stringify({
      orderItemId,
      status
    })
  })
}

//退款操作
export function refund(orderId, status,) {
  return request({
    url: '/order/order/refund',
    method: 'post',
    params: {
      orderId,
      status,
    }
  })
}
